{% extends 'layout.html' %}

{% load my_tags %}

{% block content %}

    <div>
        <a href="{% url_tag request 'crm:course_record_add' class_id %}" class="btn btn-primary btn-sm">新增</a>
    </div>

    <form action="" method="post" class="form-inline">
        {% csrf_token %}

        <select name="action" class="form-control">

            <option value="multi_init">批量初始化学习记录</option>

        </select>
        <button class="btn btn-success btn-sm">提交</button>

        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>选择</th>
                <th>序号</th>
                <th>课程名</th>
                <th>课程日期</th>
                <th>课程标题</th>
                <th>是否有作业</th>
                <th>作业标题</th>
                <th>讲师</th>
                <th>记录者</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            {% for course_record in all_course_record %}
                <tr>
                    <td><input name="pk" type="checkbox" value="{{ course_record.pk }}"></td>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ course_record }}</td>
                    <td>{{ course_record.date }}</td>
                    <td>{{ course_record.course_title }}</td>
                    <td>{{ course_record.has_homework }}</td>
                    <td>{{ course_record.homework_title }}</td>
                    <td>{{ course_record.teacher }}</td>
                    <td>{{ course_record.recorder }}</td>

                    <td>
                        <a class="btn btn-sm btn-danger"
                           href="{% url_tag request 'crm:course_record_edit' course_record.pk %}">编辑</a>
                        <a class="btn btn-sm btn-danger"
                           href="{% url_tag request 'crm:study_record' course_record.pk %}">查看学习记录</a>
                    </td>

                </tr>
            {% endfor %}

            </tbody>
        </table>
    </form>
    <nav aria-label="Page navigation">
        <ul class="pagination">

            {{ page_html }}
        </ul>
    </nav>


{% endblock %}